package com.qbw.app.model;

import androidx.databinding.Bindable;

import com.qbw.app.BR;

import java.util.List;

/**
 * @author QBW
 * @date 2019/9/3
 */
public class EventType extends BaseModel {

    private long eventId;
    private String eventName;

    private List<SubEventType> subEventTypes;

    public EventType() {
    }

    public EventType(long eventId, String eventName) {
        this.eventId = eventId;
        this.eventName = eventName;
    }

    public long getEventId() {
        return eventId;
    }

    public void setEventId(long eventId) {
        this.eventId = eventId;
    }

    @Bindable
    public String getEventName() {
        return eventName;
    }

    public void setEventName(String eventName) {
        this.eventName = eventName;
    }

    public void setSubEventTypes(List<SubEventType> subEventTypes) {
        this.subEventTypes = subEventTypes;
    }

    public List<SubEventType> getSubEventTypes() {
        return subEventTypes;
    }

    public int subEventTypeSize() {
        return subEventTypes == null ? 0 : subEventTypes.size();
    }

    public static class SubEventType extends EventType {

        private boolean selected = true;

        public SubEventType() {
        }

        public SubEventType(long eventId, String eventName) {
            super(eventId, eventName);
        }

        @Bindable
        public boolean isSelected() {
            return selected;
        }

        public void setSelected(boolean selected) {
            this.selected = selected;
            notifyPropertyChanged(BR.selected);
        }
    }

    public static class Data extends BaseModelList<EventType> {}

    public static class Response extends BaseResponse<Data> {}
}
